#!/usr/bin/perl
#file:	hc_linux_if_traffic
#time:	2008.09
#author: joecen
#site:  http://www.joecen.com/hcacti

#set the interface name if not "eth0"
my $Interface = "eth0";

open(DEV,"/proc/net/dev") or die("Error: Open file '/proc/net/dev fail!");
my @ifSTAT = grep(/$Interface/i,<DEV>);
$ifSTAT[0] =~ s/.*:\s*//;
my @IF=split(/\s+/,$ifSTAT[0]);
print "ifIN=".$IF[0].",ifOUT=".$IF[8];
